#! /bin/sh -vx
# $Id$
# Copyright 2017 Karl Berry <tex-live@tug.org>
# Copyright 2015 Peter Breitenlohner <tex-live@tug.org>
# You may freely use, modify and/or distribute this file.

BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_xdvipdfmx=$BinDir/xdvipdfmx$ExeExt

TEXMFCNF=$srcdir/../kpathsea
TFMFONTS="$srcdir/tests;$srcdir/data"
T1FONTS="$srcdir/tests;$srcdir/data"
TEXFONTMAPS="$srcdir/tests;$srcdir/data"
DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
TEXPICTS=$srcdir/tests
export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS

failed=

echo "*** xdvipdfmx -v -z0 -o ptex1.pdf ptex" && echo \
	&& $_xdvipdfmx -v -z0 -o ptex1.pdf $srcdir/tests/ptex \
	&& echo && echo "xdvipdfmx-ptex tests OK" && echo \
	|| failed="$failed xdvipdfmx-ptex"

echo "*** xdvipdfmx -v -z0 <ptex.dvi >ptex2.pdf" && echo \
	&& $_xdvipdfmx -v -z0 <$srcdir/tests/ptex.dvi >ptex2.pdf \
	&& echo && echo "xdvipdfmx-ptex (stdin->stdout) tests OK" && echo \
	|| failed="$failed xdvipdfmx-ptex (stdin->stdout)"

test -z "$failed" && exit 0
echo
echo "failed tests:$failed"
exit 1

